<extend name="Base/agent"/>
<block name="content">					
			<!--主体内容-->
			<div class="admin-main">
				<p class="current-title">订单信息</p>
				<p class="current-park"><i class="icon icon-index"></i><a href="#" class="current-index">首页</a> 〉〉 订单信息</p>
				<div class="current-condition">
					<input type="text" name="user_name" value="{:I('user_name')}" class="current-username" placeholder="用户名称"/>
					<input type="text" name="futures_name" value="{:I('futures_name')}"class="current-broker" placeholder="商品名称"/>
					<select class="yorn-broker" name="direction" id="direction">
	                    <option value="-1" <if condition="$direction eq -1">selected</if>  style="width:200px">涨跌选择</option> 
	                    <option value="3" <if condition="$direction eq 3">selected</if>  style="width:200px">平</option>
	                    <option value="1" <if condition="$direction eq 1">selected</if>  style="width:200px">涨</option>
	                    <option value="2" <if condition="$direction eq 2">selected</if>  style="width:200px">跌</option>
					</select><br><br>
					<input type="text" name="start_time" value="{:I('start_time')}" class="current-stardate" placeholder="起始时间"/>
					<span style = "margin-left:-15px">至</span>
					<input type="text" name="end_time" value="{:I('end_time')}" class="current-stardate" placeholder="结束时间"/>
					<!-- <input type="text" class="current-enddate" placeholder="结束时间"/> -->
					<input type="button" href="javascript:;" id="search" url="{:U('order')}" value="搜索" class="current-serach"/>
					<input type="reset" id="clear" value="清空" class="current-reset"/>
				</div>
				<!--数据表格-->
				<div class="main-table-data">
					<p class="table-title clearfix" >订单信息 <a href="javascript:void(0);" class="fr current-inport" id="search_two">导出报表 ></a></p>
					<table class="current-table">
						<tr>
							<th>ID</th>
							<th>订单号</th>
							<th>用户</th>
					        <th>商品名称</th>
					        <th>单价</th>
							<th>总价</th>
							<th>手数</th>
							<th>权利金</th>
							<th>开盘价格</th>
							<th>收盘价格</th>
							<th>方向</th>
							<th>开始时间</th>
							<th>结束时间</th>
							<th>创建时间</th>
						</tr>
					<foreach name="list" item="v" key="k">
						<tr <if condition="$k%2!=0">class="table-bg"<else/>class="table-nobg"</if>>
							<td>{$v.id} </td>
							<td>{$v.transaction_id} </td>
							<td>{$v.user_name}</td>
							<td>{$v.futures_name}</td>
				            <td>{$v.unit_price}</td>
				            <td>{$v.total_price}</td>
				            <td>{$v.number}</td>
				            <td>{$v.premium}</td>
				            <td>{$v.open_price}</td>
				            <td>{$v.close_price}</td>
				            <td><if condition="$v['direction'] eq 1">涨<else/><if condition="$v['direction'] eq 0">跌<else/>平</if></if></td>
				            <td><span>{$v.begin_time|time_format}</span></td>
							<td><span>{$v.end_time|time_format}</span></td>
							<td><span>{$v.create_time|time_format}</span></td>
						</tr>
					</foreach>
					</table>
					<!--分页-->
					<div class="current-page">
						{$show}
					</div>
				</div>
				
			</div>
<script type="text/javascript">
//搜索功能
    $("#search").click(function(){
        var url = $(this).attr('url');
        url = url.substr(0,url.lastIndexOf('.'));
        var query  = $('.current-condition').find('input').serialize();
        var direction=$('#direction').val();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
        query = query.replace(/^&/g,'');
        query+="/direction/"+direction;
        query = query.replace(/=/gm,"/");
        query = query.replace(/&/gm,"/");
        if( url.indexOf('?')>0 ){
        	if(query.substr(0,1) != "/"){
        		url += "/"+query;
        	}else{
        		url += query;
        	}
        }else{
            url += "/" + query;
        }
        //alert(url);
        window.location.href = url;
    });
    //导出搜索功能
        $("#search_two").click(function(){
            var url = "{:U('downorder')}";
            var query  = $('.current-condition').find('input').serialize();
            var direction=$('#direction').val();
            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
            query = query.replace(/^&/g,'');
			query+="&direction="+direction;
            if( url.indexOf('?')>0 ){
                url += '&' + query;
            }else{
                url += '?' + query;
            }
            //alert(url);
            window.location.href = url;
        });
$("#clear").click(function(){
				window.location.href="{:U('AgentCustomer/order')}&state=-2";
			})
</script>			
</block>